import request from '@/utils/request'

// 查询角色列表
export function listRole(query) {
  return request({
    url: '/system/role/list',
    method: 'get',
    params: query
  })
}

// 查询角色详细
export function getRole(roleId) {
  return request({
    url: '/system/role/' + roleId,
    method: 'get'
  })
}

// 新增角色
export function addRole(data) {
  return request({
    url: '/system/role/add',
    method: 'post',
    data: data
  })
}

// 修改角色
export function updateRole(data) {
  return request({
    url: '/system/role/edit',
    method: 'put',
    data: data
  })
}

// 删除角色
export function delRole(roleId) {
  return request({
    url: '/system/role/' + roleId,
    method: 'delete'
  })
}

//获取所有角色
export function roleOptionselect(){
  return request({
    url: '/system/role/optionselect',
    method: 'get'
  })
}

// 查询该角色的菜单权限与所有菜单--树状结构
export function roleMenuTreeselect(roleId){
  return request({
    url:'/system/menu/roleMenuTreeselect/'+roleId,
    method: 'get',
  })
}

// 设置角色权限菜单
export function editMenuByRole(data) {
  return request({
    url: '/system/role/editMenuByRole',
    method: 'put',
    data: data
  })
}

